import util from "../utils/util.js";

//获取预油品订单
function getOilOrderModel(id, money) {
    const url = util.api.prepare;
    const method = "POST";
    const data = {
        token: util.token,
        gun_id: id,
        money: money
    }
    return util.sendRequest(url, method, data)
}

//生成油品订单
const orderToModel = function (index, orderList) {
    const url = util.api.oil;
    const method = 'POST';
    let data = {
        token: util.token,
        gun_id: orderList.gun_id,
        money: orderList.money
    }
    console.log(data)
    if (index > 0) {
        data.coupon_id = orderList.coupon_list[index - 1].user_cou_id
    } else {
        delete data.coupon_id
    }
    return util.sendRequestFail(url, method, data)
}




export {
    getOilOrderModel,
    orderToModel,
}